<!DOCTYPE html>
<html>
  <head>
    <title>sofaDetail.html</title>
	
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <link rel="stylesheet" type="text/css" href="css/pubStyle.css">
	<link rel="stylesheet" type="text/css" href="css/test.css">
	<link rel="stylesheet" type="text/css" href="css/sofaDetail.css">
	<script type="text/javascript" src="js/provincelink.js"></script>
    <script type="text/javascript" src="js/cookie_util.js"></script>
    <script type="text/javascript" src="js/jquery-1.11.1.js"></script>
    <script type="text/javascript" src="js/sofa.js"></script>
    <script type="text/javascript">
        var sofaId = getCookie("qrySofaDetialSofaId");
        //alert("sofaDetial:"+sofaId);
        if(sofaId == null || sofaId == ""){
            window.location.href="homePage.html";
        }else{
            //alert("查询沙发详细信息");
            $.ajax({
                url:"/SofaGuest/sofa/qrySofa.do",
                type:"post",
                data:{"sofaId":sofaId},
                dataType:"json",
                success:function(result){
                    if("0000" == result.status){
                        var sofaInfo = result.data.sofaInfo;
                        $("#safetitle").html(sofaInfo.sofa_title);
                        $("#safehost").html(sofaInfo.host_id);
                        $("#safetype").html(sofaInfo.sofa_type);
                        $("#safeaddress").html(sofaInfo.sofa_address);
                        $("#safemixper").html(sofaInfo.person_num+"人");
                        $("#safetime").html(sofaInfo.max_use_time+"天");
                        $("#safesex").html(sofaInfo.use_sex);
                        $("#safeage").html(sofaInfo.min_age+"-"+sofaInfo.max_age);
                        $("#safeqq").html(sofaInfo.qq);
                        $("#safetel").html(sofaInfo.host_phone);
                        $("#safegoods").html(sofaInfo.own_goods);
                        $("#saferemark").html(sofaInfo.sofa_explain);
                        $("#show-img").html('<img src=/SofaGuest'+sofaInfo.sofa_emg+' id="largerimg" width="400" height="400"/>');
                        
                        var msgInfos = result.data.msgInfo;
                        if(null==msgInfos||""==msgInfos){
                            $("#msgInfo").html("暂无评论");
                        }else{
                            for(var i=0;i<msgInfos.length;i++){
                                var msgInfo = msgInfos[i];
                                var author = msgInfo.user_id;
                                var comtime = msgInfo.massage_date;
                                var massage = msgInfo.massage;
                                var msgDiv = '<div class="listdiv"><div id="listtitle">'+
                                             '<span id="comuser">'+author+'</span>&nbsp;&nbsp;&nbsp;&nbsp;'+
                                             '<span id="comspan">发布于：</span><span id="comtime">'+comtime+'</span>'+
                                             '<span id="floorid">'+(i+1)+'#</span></div>'+
                                             '<div id="listCom">'+
                                             //'<h4>真是一次不错的旅行</h4>'+
                                             '<p>'+massage+'</p></div></div>';
                                $("#msgInfo").append(msgDiv);
                            }
                        }
                    }else{
                        alert(result.detial);
                        window.location.href="qrySofa.html";
                    }
                },
                error:function(){
                    alert("系统异常,请稍后重试");
                }
            });
        }
        $(function(){
            var realName = getCookie("realName");
            $("#acctId").html(realName);
            logOut();//退出登录功能
            $("#reserversub").click(function(){
                addCookie("orderSofa",sofaId,1);
                window.location.href="reserve.html";
            });
        });
    </script>

  </head>
  
  <body>
    <div class="top">
		<div class="top-page">
			<div id="nav-title">
				<a href="homePage.html" class="title">首页</a>
            	<a href="Javascript:void(0)" class="title" onclick="gotoqrySofaHtml()">找沙发</a>
                <!-- <a href="qrySofa.html" class="title">找沙发</a> -->
            	<a href="addSofa.html" class="title">我有沙发</a>
            	<a href="travelList.html" class="title">分享沙旅</a>
            	<a href="personMan.html" class="title">个人管理</a>
			</div>
			<div id="loginfo">
				<span>当前登陆：</span>
				<span id="acctId"></span>
				<span><a href="Javascript:void(0)" id="safeout"  target="_self">安全退出</a></span>
			</div>
		</div>
	</div>
	<div class="main-page">
		<div class="emp-line"></div>
		<div class="main-content">
			<div class="content-detail">
				<div class="detail-img">
					<div id="show-img">
						<!-- <img src="img/tim.jpg" id="largerimg" width="400" height="400"/> -->
					</div>
				</div>
				<div class="detail-list">
					<div id="show-list">
					<h3 id="safetitle">大奖赛卡拉胶抵抗力撒娇了靠的就是卡了</h3><br/>
					<span class="spandetail">沙发主人：</span><span class="spanvalue" id="safehost">崔健</span>
					<span class="spandetail" id="safetypeid">沙发类型：</span><span class="spanvalue" id="safetype">我有地板</span><br/>
					<span class="spandetail">沙发坐标：</span><span class="spanvalue" id="safeaddress">北京-西城区-紫禁城</span><br/>
					<span class="spandetail">最大接待数：</span><span class="spanvalue" id="safemixper">3人</span>
					<span class="spandetail" id="safetimeid">最长接待时间：</span><span class="spanvalue" id="safetime">10天</span><br/>
					<span class="spandetail">性别限制：</span><span class="spanvalue" id="safesex">不限</span>
					<span class="spandetail" id="safeageid">年龄限制：</span><span class="spanvalue" id="safeage">20-25</span><br/>
					<span class="spandetail">QQ/邮箱：</span><span class="spanvalue" id="safeqq">494730414</span><br/>
					<span class="spandetail">联系方式：</span><span class="spanvalue" id="safetel">13113131313</span><br/>
					<span class="spandetail">沙发物品：</span><span class="spanvalue" id="safegoods">哈哈|哈哈|狗狗</span><br/>
					<span class="spandetail">说明：</span><span class="spanvalue" id="saferemark">阿斯顿法国和健康</span><br/>
					<input type="button" id="reserversub"  value="预约入住"/>
					</div>
				</div>
			</div>
			<div class="emp-line"></div>
			<div class="comment">
				<div class="emp-line"></div>
				<div class="emp-line"></div>
				<div class="qrySofaimg">
						<span>&nbsp;&nbsp;评论列表</span>
				</div>
				<div class="comment-list" id="msgInfo">
					<!-- 这里需要动态生成  class="listdiv"
					<div class="listdiv">
						<div id="listtitle">
							<span id="comuser">author</span>&nbsp;&nbsp;&nbsp;&nbsp;
							<span id="comspan">发布于：</span><span id="comtime">2017-04-16</span>
							<span id="floorid">1#</span>
						</div>
						<div id="listCom">
							<h4>真是一次不错的旅行</h4>
							<p>内容十五字组三个行业内容十五字组三个行业内容十五字组三个行业内容十五字组三个行业内容十五字组三个行业内容十五字组三个行业内容十五字组三个行业内容十五字组三个行业内容十五字组三个行业内容十五字组三个行业内容十五字组三个行业内容十五字组三个行业</p>
						</div>
					</div>-->
				</div>
			</div>
		</div>
		</div>
		<div class="feet">
		<a href="homePage.html">首页</a><span>|</span>
		<a href="addSofa.html">新增沙发</a><span>|</span>
		<a href="register.html">入驻沙主</a><span>|</span>
		<a href="personMan.html">信息管理</a><span>|</span>
		<a href="adminman.html">后台管理</a><span>|</span>
		<a href="index.html">退出登录</a>
	</div>
  </body>
</html>
